/*
 * Alvin Baldemeca
 * TCSS 305 - Spring 2012
 * Assignment 4 Power Paint
 */

package gui.actions.paint;

import java.awt.event.ActionEvent;
import java.awt.event.KeyEvent;

import javax.swing.AbstractAction;
import javax.swing.Action;
import javax.swing.ImageIcon;

import view.container.TetrisPaintPanel;

/**
 * The action to be attached to the ellipse tool in the Power Paint program.
 * @author Alvin Baldemeca
 * @version 5/10/2012
 */
@SuppressWarnings("serial")
public class EllipseAction extends AbstractAction
{
  
  /**
   * The panel to perform the action to.
   */
  private final TetrisPaintPanel my_panel;
  
  /**
   * Creates an action when the ellipse tool is selected.
   * @param the_panel the panel that the color tool will be used on
   */
  public EllipseAction(final TetrisPaintPanel the_panel) 
  {
    super("Ellipse", new ImageIcon("ellipse_bw.gif"));
    my_panel = the_panel;
    putValue(Action.MNEMONIC_KEY, KeyEvent.VK_E);
    putValue(Action.SELECTED_KEY, true);
  }

  @Override
  public void actionPerformed(final ActionEvent the_event) 
  {
    my_panel.drawEllipse();
  }
  
  
}
